const express = require('express')
const cors = require('cors')
const menuRoutes = require('./api/menu')
const permissionRoutes = require('./api/permission')
const loginRoutes = require('./api/login')
const ip = require('./ip.config')

const app = express()
const port = 3000

app.use(cors())
app.use(express.json())

const baseUrl = '/api'

app.use(baseUrl, menuRoutes)
app.use(baseUrl, permissionRoutes)
app.use(baseUrl, loginRoutes)
app.listen(port, () => {
  console.log(`Mock API is running at http://localhost:${port}`)
  console.log(`Mock API is running at http://${ip}:${port}`)
})
